home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
recio202.zip
/
rput.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-05
|
2KB
|
50 lines
/*****************************************************************************
MODULE: rput.c
PURPOSE: recio output functions
COPYRIGHT: (C) 1994 William Pierpoint
COMPILER: Borland C Version 3.1
OS: MSDOS Version 6.2
VERSION: 2.02
RELEASE: May 5, 1994
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "recio.h"
extern int _rstatus(REC *rp, int mode);
extern int _rputc(REC *rp, int ch);
#define rcol(rp) ((rp)->r_colno)
/****************************************************************************/
int /* return error (0=no error; !0=error) */
rputrec( /* put end-of-record (newline) to stream */
REC *rp) /* record pointer */
/****************************************************************************/
{
int err=EOF; /* return error (0=no error; !0=error) */
if (!_rstatus(rp, R_WRITE)) {
err = _rputc(rp, '\n');
rcol(rp)=0;
rfldno(rp)=0;
rrecno(rp)++;
}
return err;
}
/****************************************************************************/
char * /* return pointer to string */
dtoa( /* convert floating point number to string */
double d, /* number to convert */
int dig, /* number of significant digits */
char *str) /* string buffer to use */
/****************************************************************************/
{
sprintf(str, "%.*G", dig, d);
return str;
}